﻿<%@ Page Title="" Language="C#" MasterPageFile="~/manager.Master" AutoEventWireup="true" CodeBehind="data_time_round.aspx.cs" Inherits="Bus_proj.website.data_time_round" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <link href="../Styles/Stylebuttoncss.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/textbox.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
    function divexpandcollapse(divname) {
        var div = document.getElementById(divname);
        var img = document.getElementById('img' + divname);
        if (div.style.display == "none") {
            div.style.display = "inline";
            img.src = "../Images/minus.gif";
        } else {
            div.style.display = "none";
            img.src = "../Images/plus.gif";
        }
    }   
</script>    


    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            height: 22px;
        }
        .style3
        {
            height: 22px;
            width: 419px;
        }
        .style4
        {
            width: 419px;
        }
        .style7
        {
            width: 419px;
            height: 59px;
        }
        .style8
        {
            height: 59px;
        }
        .BG
        {
            width:500px;
            padding:10px;
            border:3px solid #dedede;
            background:#2F4F4F;
            filter:alpha(opacity=40); 
            opacity:0.4; 
        }
        .panal
        {
            border-radius:5px;
            -khtml-border-radius:5px;
            -moz-border-radius:5px;
            padding:10px;
            background:#F5FFFA;
            width:350px;
        }
        .style10
        {
            width: 415px;
        }
        .style11
        {
            width: 106px;
        }
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
    <asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
    <asp:AsyncPostBackTrigger ControlID="Button4" EventName="Click" />    
    </Triggers>

     <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
    BackgroundCssClass="BG"
    PopupControlID="Panel1"
    TargetControlID="ImageButton1"
    CancelControlID="Button4">
    </asp:ModalPopupExtender>
        
<fieldset class="el03">
<legend>ข้อมูลวันที่และสายรถ</legend>
<fieldset class="el02">
    <table class="style1">
        <tr>
            <td class="style3" align="right">
                &nbsp;</td>
            <td class="style2">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style3" align="right">
                &nbsp;</td>
            <td class="style2">
                &nbsp;</td>
        </tr>
        <tr>
            <td align="right" class="style7">
                <asp:Label ID="Label3" runat="server" Text="หมายเลขสายรถ"></asp:Label>
            </td>
            <td class="style8">
                <asp:DropDownList ID="DropDownList3" runat="server" Width="152px" 
                    DataSourceID="LinqDataSource1" DataTextField="Route_id" 
                    DataValueField="Route_id" CssClass="textbox">
                    <asp:ListItem Selected="True" Value="0">*เลือกหมายเลขสายรถ</asp:ListItem>
                </asp:DropDownList>
                <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
                    ContextTypeName="Bus_proj.DataClasses1DataContext" EntityTypeName="" 
                    TableName="Table_Routes">
                </asp:LinqDataSource>
            </td>
        </tr>
        <tr>
            <td align="right" class="style4">
                &nbsp;</td>
            <td>
                <asp:Button ID="Button1" runat="server" Height="40px" Text="ตกลง" 
                    Width="94px" onclick="Button1_Click" CssClass="classname" />
            </td>
        </tr>
        <tr>
            <td align="right" class="style4">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
</fieldset>  

    <asp:Panel ID="Panel1" runat="server" CssClass="panal" style="display:none">
    <fieldset class="el02">  
    <legend>เพิ่มเวลาเดินรถ</legend>
        <table class="style1">
            <tr>
                <td align="right" class="style11">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td align="right" class="style11">
                    <asp:Label ID="Label4" runat="server" Text="เวลาเดินรถ"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="TextBox2" runat="server" TextMode="Time" CssClass="textbox"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style11">
                    &nbsp;</td>
                <td>
                    <asp:Button ID="Button2" runat="server" OnClientClick="return confirm('ยืนยันการเพิ่มรายการ')" Height="40px" onclick="Button2_Click" 
                        Text="เพิ่ม" Width="79px" CssClass="classname" />
                    <asp:Button ID="Button4" runat="server" Height="40px" onclick="Button4_Click" 
                        Text="ยกเลิก" Width="95px" CssClass="classname" />
                </td>
            </tr>
            <tr>
                <td class="style11">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
        </fieldset> 
    </asp:Panel>

<asp:Panel ID="Panel_tableRound" runat="server" Visible="False" >
<fieldset class="el03">  
<legend>ตารางแสดงสายการเดินทาง</legend>
    <table class="style1">
        <tr>
            <td align="center">
                &nbsp;</td>
        </tr>
        <tr>
            <td align="center">           
            <asp:ImageButton ID="ImageButton1" runat="server" style="display:none"/>                                    
                <asp:GridView ID="gvEmployeeDetails" runat="server" AutoGenerateColumns="False" 
                    Font-Size="Medium" onrowcommand="gvEmployeeDetails_RowCommand" 
                    OnRowDataBound="gvEmployeeDetails_OnRowDataBound" ShowFooter="True" 
                    Width="683px">
                    <Columns>
                        <asp:TemplateField ItemStyle-Width="20px">
                            <ItemTemplate>
                                <a href="JavaScript:divexpandcollapse('div<%# Eval("Route_id") %>');">
                                <img id="imgdiv<%# Eval("Route_id") %>" width="9px" border="0" src="../Images/plus.gif"
                                alt="" />
                                </a>
                            </ItemTemplate>
                            <ItemStyle VerticalAlign="Middle" Width="20px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="รหัสเส้นทางเดินรถ">
                            <ItemTemplate>
                                <asp:Label ID="lblEmpID" runat="server" 
                                    Text='<%#DataBinder.Eval(Container.DataItem, "Route_id") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="Route_source" HeaderText="ชื่อต้นทาง" />
                        <asp:BoundField DataField="Route_destination" HeaderText="ชื่อปลายทาง" />
                        <asp:BoundField DataField="Route_distance" HeaderText="ระยะทางรวม" />
                        <asp:TemplateField HeaderText="เพิ่มเวลาเดินรถ">
                            <ItemTemplate>
                                <asp:ImageButton ID="ImageButton1" runat="server" OnClientClick="return confirm('ยืนยันการเพิ่มรายการ')" Height="20px" 
                                    ImageUrl="~/Images/Actions-document-save-as-icon.png" Width="20px" CommandArgument='<%#Eval("Route_id") %>' CommandName="cmdN" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <tr>
                                    <td colspan="100%">
                                        <div ID='div<%# Eval("Route_id") %>' 
                                            style="overflow:auto; display:none; position: relative; left: 15px; overflow: auto">
                                            <asp:GridView ID="gv_Child" runat="server" AutoGenerateColumns="false" 
                                                DataKeyNames="Route_id" Width="95%">
                                                <Columns>
                                                    <asp:BoundField DataField="Time_time" HeaderText="เวลาเดินรถ" />
                                                    <asp:TemplateField HeaderText="ลบเวลาเดินรถ">
                                                        <ItemTemplate>
                                                             <asp:ImageButton ID="ImageButton1" runat="server" OnClientClick="return confirm('ยืนยันการลบรายการ')" Height="20px" 
                                    ImageUrl="~/Images/delete-icon.png" Width="20px" CommandArgument='<%#Eval("Time_id") %>' CommandName="cmdY" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                </Columns>
                                                <HeaderStyle BackColor="#4D92C1" ForeColor="White" />
                                            </asp:GridView>
                                        </div>
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <HeaderStyle BackColor="#0063A6" ForeColor="White" />
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td align="center">
                &nbsp;</td>
        </tr>
        </table>
</fieldset>
</asp:Panel> 



</fieldset>
    </ContentTemplate>
    </asp:UpdatePanel>

</asp:Content>
